package metier.Service;

import java.util.List;
import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import metier.entities.Transport;
import metier.sess.ITransportLocal;


@Stateless
@WebService
public class TransportService {
	@EJB(beanName="Transport")
	private ITransportLocal metier;
	
	
	@WebMethod
	public void addTransport(@WebParam(name="Intitule")String Initule,@WebParam(name="Statut")boolean statut)
	{
		Transport tr=new Transport(Initule, statut);
		metier.addTransport(tr);
	}
	
	@WebMethod
	public List<Transport> listTransport()
	{
		return metier.getAllTransport();
	}
	
	@WebMethod 
	public Transport getTransport(@WebParam(name="Id")Integer Id)
	{
		return metier.getTransport(Id);
	}
	
	
	@WebMethod
	public void UpdateTransport(@WebParam(name="Id")Integer Id,@WebParam(name="Intitule")String Intitule,@WebParam(name="Statut")boolean statut)
	{
	
		Transport Tr=metier.getTransport(Id);
		Tr.setIntitule(Intitule);
		Tr.setStatut(statut);
		metier.updateTransport(Tr);
		
	}
	
	@WebMethod
	public void DeleteTransport(@WebParam(name="Id")Integer Id)
	{
		metier.deleteTransport(Id);
	}
	
	

}
